<?php

/**
 * 轮播图
 */

namespace app\api\controller;

use app\common\controller\ApiController;
use think\Exception;
use app\api\model\Statistical as StatisticalModel;

class Statistical extends ApiController {
    protected $isSign = false;
    protected $isEncrypt = false;
    protected $notNeedToken = ['getstatistical','getareadata'];

    protected $notNeedPhone = ['getstatistical','getareadata'];

    protected $isArrayResult = ['getstatistical','getareadata'];

    /**
     * 城市数据统计
     * @return false|string
     */
    public function getStatistical() {
        try {
            $params = $this->checkParams ('city_code');
            $StatisticalModel = new StatisticalModel();
            $data = $StatisticalModel->getStatistical($params);
            return $this->resData('success', $data);
        } catch (Exception $e) {
            return $this->resErr($e->getMessage(), $e->getCode());
        }
    }

    /**
     * 城市区域数据排行
     * @return false|string
     */
    public function getAreaData() {
        try {
            $params = $this->checkParams ('city_code');
            $StatisticalModel = new StatisticalModel();
            $data = $StatisticalModel->getAreaData($params);
            return $this->resData('success', $data);
        } catch (Exception $e) {
            return $this->resErr($e->getMessage(), $e->getCode());
        }
    }

}
